<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <title>1_天气案例</title>
        <script type="text/javascript" src="../js/vue.js"></script>
    </head>
    <body>
        <div id="demo">
            <h1>今天天气很{{info}}</h1>
            <button @click="changeWeather">切换天气</button>
        </div>
    </body>

    <script type="text/javascript">
        Vue.config.productionTip = false;

        new Vue({
            el: '#demo',
            data: {
                isHot: true
            },
            computed: {
                info(){
                    return this.isHot ? '炎热' : '凉爽'
                }
            },
            methods: {
                changeWeather(){
                    this.isHot = !this.isHot
                }
            }
        })
        
    </script>
</html>